package com.youchuang.action.user;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.InterceptorRef;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;

import com.youchuang.action.BaseAction;
import com.youchuang.common.Constant;
import com.youchuang.service.UserService;

/**
 * 邮箱验证
 * 
 * @author Administrator
 *
 */
@Namespace(value = "/user")
@ParentPackage("shopping-default")
public class VerifyAction extends BaseAction {
	private Logger logger = Logger.getLogger(VerifyAction.class.getSimpleName());
	private String code;
	@Resource
	private UserService userService;

	@Action(value = "verify", interceptorRefs = { @InterceptorRef(value = "tokenStack") }, results = {
			@Result(name = Constant.VERIFY, location = "/WEB-INF/jsp/user/verify_form.jsp"),
			@Result(name = Constant.SUCCESS, location = "/WEB-INF/jsp/user/register_ok.jsp"), })
	public String execute() {
		logger.info("execution is execute");

		return userService.verifyUser(code);
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}
}
